<template>
  <div id="app">
    <template v-if="needLayout">
      <layout />
    </template>
    <template v-else>
      <router-view />
    </template>
  </div>
</template>

<script>
import Layout from '@/components/layout.vue'
import store from '@/store/index'

export default {
  name: 'App',
  components: { Layout },
  data () {
    return {

    }
  },
  computed: {
    isLogin () {
      return store.state.user.isLogin
    },
    needLayout () {
      const meta = this.$route.meta
      if (typeof meta.needLayout !== 'undefined') {
        return meta.needLayout
      } else if (typeof meta.auth !== 'undefined') {
        return meta.auth
      } else {
        return true
      }
    }
  }
}
</script>

<style>
</style>
